package com.ruoyi.restaurant.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import javax.validation.constraints.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * /菜单表 tb_restsurant
 *
 * @author ruoyi
 */
public class Menu extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * ID
     */
    @Excel(name = "菜单序号", cellType = Excel.ColumnType.NUMERIC)
    private Long id;

    /**
     * 标题
     */
    @Excel(name = "菜单名称")
    @NotBlank(message = "菜单名称不能为空")
    @Size(min = 1, max = 50, message = "菜单名称长度必须在1到50个字符之间")
    private String name;
    /**
     * 库存数量
     */
    @Excel(name = "库存数量")
    @NotBlank(message = "库存数量不能为空")
    private int num;

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    /**
     * 公告内容
     */
    @Excel(name = "描述信息")
    @Size(max = 200, message = "描述信息长度不能超过200个字符")
    private String description;

    @Excel(name = "价钱")
    @NotNull(message = "价格不能为空")
    @DecimalMin(value = "0.01", message = "价格必须大于0.01")
    @Digits(integer = 8, fraction = 2, message = "价格格式不正确")
    private BigDecimal price;
    
    /**
     * 公告状态（0正常 1关闭）
     */
    @Excel(name = "售卖状态",readConverterExp = "0=正常,1=停用")
    @Pattern(regexp = "^[01]$", message = "售卖状态只能是0（正常）或1（停用）")
    private String status;

    /**
     * 餐品所属类型（前厅/后厨/吧台）
     */
    @Excel(name = "餐品类型")
    @NotBlank(message = "餐品类型不能为空")
    @Pattern(regexp = "^(前厅|后厨|吧台)$", message = "餐品类型只能是：前厅、后厨、吧台")
    private String categoryType;

    @Excel(name = "创建时间",dateFormat = "yyyy-MM-dd HH:mm:ss")
    /** 创建时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /** 更新者 */
    private String updateBy;

    @Override
    public Date getCreateTime() {
        return createTime;
    }

    @Override
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Override
    public Date getUpdateTime() {
        return updateTime;
    }

    @Override
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    @Excel(name = "更新时间",dateFormat = "yyyy-MM-dd HH:mm:ss")
    /** 更新时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;


    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getCategoryType() {
        return categoryType;
    }

    public void setCategoryType(String categoryType) {
        this.categoryType = categoryType;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId())
                .append("name", getName())
                .append("price", getPrice())
                .append("num", getNum())
                .append("descriptoion", getDescription())
                .append("status", getStatus())
                .append("categoryType", getCategoryType())
                .append("createTime", getCreateTime())
                .append("updateTime", getUpdateTime())
                .toString();
    }
}